import { createStore, applyMiddleware } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension';
import thunk, { ThunkAction } from 'redux-thunk';
import reducers, { RootActions } from './reducers';

const store = createStore(
  reducers,
  composeWithDevTools(applyMiddleware(thunk))
);

export type RootState = ReturnType<typeof store.getState>;
export type RootThunkAction = ThunkAction<
  Promise<void>,
  RootState,
  unknown,
  RootActions
>;

export default store;
